package com.cskaoyan.controller.wx_brand;

import com.cskaoyan.bean.mall.brand.Brand;
import com.cskaoyan.bean.wx_brand.exception.BrandParamException;
import com.cskaoyan.bean.wx_resp.WxRespVo;
import com.cskaoyan.bean.wx_brand.base.BrandPageData;
import com.cskaoyan.bean.wx_brand.base.BrandParam;
import com.cskaoyan.service.wx_brand.WxBrandService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author liXiaoFei
 * @date 2021/10/21 16:15
 */

@RestController
@RequestMapping("wx/brand")
public class WxBrandController {

    @Autowired
    WxBrandService wxBrandService;

    @GetMapping("list")
    public WxRespVo list(BrandParam brandParam){
        BrandPageData data = wxBrandService.queryBrand(brandParam);
        return WxRespVo.ok(data);
    }

    @GetMapping("detail")
    public WxRespVo detail(Integer id) throws BrandParamException {
        Brand brand = wxBrandService.queryBrandById(id);
        return WxRespVo.ok(brand);
    }

}
